import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_public/flutter_public.dart';

/// FileName home_bar
///
/// @Author lax
/// @Date 2023/4/6
///
/// @Description

class HomeBar extends StatelessWidget {
  static double defaultHeight = 0;

  static Color? defaultColor;

  final Color? color;

  const HomeBar({super.key, this.color});

  @override
  Widget build(BuildContext context) {
    return Container(
      color: color ?? defaultColor,
      height: height(context),
    );
  }

  static double height([BuildContext? context]) {
    context ??= FlutterPublic.navigatorKey?.currentContext;
    if (context == null) {
      return defaultHeight;
    }
    final bottom = MediaQuery.of(context).padding.bottom;
    return max(bottom, defaultHeight);
  }
}
